/**
 * 
 */
package com.scaffold.springmvc.action;

import java.io.File;
import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import com.scaffold.BasicBizAction;

/**
 * @author wangjg
 *
 */
@Controller
public class UploadAction extends BasicBizAction {

	/**
	 * 需要配置multipartResolver
	 */
	@RequestMapping("/upload.xhtml")
	public void upload(HttpServletRequest request, HttpServletResponse response) throws IOException{
		MultipartHttpServletRequest mpRequest = (MultipartHttpServletRequest) request;
		MultipartFile file = mpRequest.getFile("file");
		file.transferTo(new File("e:\\temp\\aaa.jpg"));
	}
}
